package com.cros.pruebas2;

import java.util.Date;

public class CheckGC {
    public static void main (String[] args){
        Runtime rt = Runtime.getRuntime();
        System.out.println("Memoria Total de la JVM: " +
        rt.totalMemory()); System.out.println("Memoria Antes: " + rt.freeMemory());
        Date d = null;
        for (int i = 0; i < 10000; i++){
            d = new Date();
            d = null;
        }
        System.out.println("Memoria Despues: " + rt.freeMemory());
        rt.gc();
        System.out.println("Despues del GC: " + rt.freeMemory());
    }
} 